#Boa:Frame:receberProfissionalFrame

import wx
from BancoDeDados import*
bd  = BancoDeDados()

def create(parent):
    return receberProfissionalFrame(parent)

[wxID_RECEBERPROFISSIONALFRAME, wxID_RECEBERPROFISSIONALFRAMEESPNOME, 
 wxID_RECEBERPROFISSIONALFRAMEESPTEMPO, wxID_RECEBERPROFISSIONALFRAMEESPVALOR, 
 wxID_RECEBERPROFISSIONALFRAMEHORAS, wxID_RECEBERPROFISSIONALFRAMELIMPAR, 
 wxID_RECEBERPROFISSIONALFRAMEPANEL1, wxID_RECEBERPROFISSIONALFRAMESALVAR, 
 wxID_RECEBERPROFISSIONALFRAMESTATICBOX1, 
 wxID_RECEBERPROFISSIONALFRAMESTATICTEXT1, 
 wxID_RECEBERPROFISSIONALFRAMESTATICTEXT2, 
 wxID_RECEBERPROFISSIONALFRAMESTATICTEXT3, 
 wxID_RECEBERPROFISSIONALFRAMESTATICTEXT4, 
] = [wx.NewId() for _init_ctrls in range(13)]

class receberProfissionalFrame(wx.Frame):

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_RECEBERPROFISSIONALFRAME,
              name='receberProfissionalFrame', parent=prnt, pos=wx.Point(413,
              279), size=wx.Size(445, 207), style=wx.DEFAULT_FRAME_STYLE,
              title='Receber')
        self.SetClientSize(wx.Size(429, 169))

        self.panel1 = wx.Panel(id=wxID_RECEBERPROFISSIONALFRAMEPANEL1,
              name='panel1', parent=self, pos=wx.Point(0, 0), size=wx.Size(429,
              169), style=wx.TAB_TRAVERSAL)

        self.staticBox1 = wx.StaticBox(id=wxID_RECEBERPROFISSIONALFRAMESTATICBOX1,
              label='Profissional', name='staticBox1', parent=self.panel1,
              pos=wx.Point(0, 0), size=wx.Size(432, 168), style=0)
        self.staticBox1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.horas = wx.StaticText(id=wxID_RECEBERPROFISSIONALFRAMEHORAS,
              label='Tempo Gasto', name='horas', parent=self.panel1,
              pos=wx.Point(8, 128), size=wx.Size(77, 16), style=0)
        self.horas.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.staticText1 = wx.StaticText(id=wxID_RECEBERPROFISSIONALFRAMESTATICTEXT1,
              label='Receber de', name='staticText1', parent=self.panel1,
              pos=wx.Point(8, 48), size=wx.Size(65, 16), style=0)
        self.staticText1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.EspValor = wx.TextCtrl(id=wxID_RECEBERPROFISSIONALFRAMEESPVALOR,
              name='EspValor', parent=self.panel1, pos=wx.Point(88, 88),
              size=wx.Size(100, 21), style=0, value='')

        self.staticText2 = wx.StaticText(id=wxID_RECEBERPROFISSIONALFRAMESTATICTEXT2,
              label='Valor R$', name='staticText2', parent=self.panel1,
              pos=wx.Point(8, 88), size=wx.Size(49, 16), style=0)
        self.staticText2.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.EspNome = wx.ComboBox(choices=bd.listar_profissionais(),
              id=wxID_RECEBERPROFISSIONALFRAMEESPNOME, name='EspNome',
              parent=self.panel1, pos=wx.Point(88, 48), size=wx.Size(248, 21),
              style=0, value='')
        self.EspNome.SetLabel('')

        self.EspTempo = wx.TextCtrl(id=wxID_RECEBERPROFISSIONALFRAMEESPTEMPO,
              name='EspTempo', parent=self.panel1, pos=wx.Point(88, 128),
              size=wx.Size(100, 21), style=0, value='')

        self.staticText3 = wx.StaticText(id=wxID_RECEBERPROFISSIONALFRAMESTATICTEXT3,
              label='ex: 2h35m', name='staticText3', parent=self.panel1,
              pos=wx.Point(216, 136), size=wx.Size(52, 13), style=0)
        self.staticText3.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.staticText4 = wx.StaticText(id=wxID_RECEBERPROFISSIONALFRAMESTATICTEXT4,
              label='ex: 35.50', name='staticText4', parent=self.panel1,
              pos=wx.Point(216, 96), size=wx.Size(48, 13), style=0)
        self.staticText4.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.limpar = wx.Button(id=wxID_RECEBERPROFISSIONALFRAMELIMPAR,
              label=u'Limpar', name=u'limpar', parent=self.panel1,
              pos=wx.Point(288, 112), size=wx.Size(75, 23), style=0)
        self.limpar.Bind(wx.EVT_BUTTON, self.OnLimparButton,
              id=wxID_RECEBERPROFISSIONALFRAMELIMPAR)

        self.salvar = wx.Button(id=wxID_RECEBERPROFISSIONALFRAMESALVAR,
              label=u'Salvar', name='salvar', parent=self.panel1,
              pos=wx.Point(288, 88), size=wx.Size(75, 23), style=0)
        self.salvar.Bind(wx.EVT_BUTTON, self.OnSalvarButton,
              id=wxID_RECEBERPROFISSIONALFRAMESALVAR)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnLimparButton(self, event):
        self.EspValor.SetValue('')
        self.EspTempo.SetValue('')
    def OnSalvarButton(self, event):
        bd.cadastrar_renda(self.EspNome.GetLabel(), float(self.EspValor.GetValue()),bd.trans_tempo(self.EspTempo.GetValue()) )
        self.EspValor.SetValue('')
        self.EspTempo.SetValue('')
